﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using HNQXYJ.Model;
using HNQXYJ.BLL;

namespace HNQXYJ.HN_City
{
    public partial class CountyAdd : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        /// <summary>
        /// 增加一个新的县区
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void add_Click(object sender, ImageClickEventArgs e)
        {

                 HCounty county = new HCounty();
                 county.Name = this.txtCountyName.Text.Trim();
                 county.ParentCode = this.HidCity.Value;
                 county.SelfCode =this.HidCity.Value + this.txtCountyCode.Text.Trim();
                 county.DateAdd = DateTime.Now;
                 county.Lng = Convert.ToDouble(this.txtLng.Text.Trim());
                 county.Lat = Convert.ToDouble(this.txtLat.Text.Trim());
                 this.Label2.Text = this.HidCity.Value;
                 int res = new CountyBLL().AddCounty(county);
                 if (res > 0)
                 {
                     Response.Redirect("CountyMgr.aspx");
                 }


            

        }

        protected void reset_Click(object sender, ImageClickEventArgs e)
        {
            Response.Redirect("CountyMgr.aspx");
        }
    }
}